#ifndef _CRT_MSGHDR_H_
#define _CRT_MSGHDR_H_

#include <crt_core.hpp>

#ifdef __cplusplus
extern "C" {
#endif

#if (TARGET_OS == OS_WIN)

#define IOV_MAX 255

#pragma pack(push, 1)

struct iovec {
    void* iov_base;
    size_t iov_len;
};

struct msghdr {
    void* msg_name;
    size_t msg_namelen;
    struct iovec* msg_iov;
    size_t msg_iovlen;
    void* msg_control;
    size_t msg_controllen;
    int msg_flags;
};

#pragma pack(pop)

ssize_t sendmsg(int fd, const struct msghdr* msg, int flags);
ssize_t recvmsg(int fd, struct msghdr* msg, int flags);

#endif

#ifdef __cplusplus
}
#endif

#endif
